import { Random } from "mockjs"; // 导出随机函数

import Mock from "mockjs";

function pageSearchEmployee(req: any) {
  let { data } = Mock.mock({
    "data|1-7": [
      {
        "id|+13": 0,
        username: "@cname()",
        password: "123",
        roles: Random.pick(["ROLE_ADMIN", "ROLE_EMPLOYEE"]),
        status: Random.pick([1, 0]),
      },
    ],
  });

  console.log(data.data);

  return {
    success: true,
    message: "",
    code: "200",
    data: {
      data: data,
      total: 50,
    },
  };
}

function searchSingleEmployee(req: any) {
  let data = Mock.mock({
    id: 1,
    username: "@cname()",
    password: "123",
    roles: Random.pick(["ROLE_ADMIN", "ROLE_EMPLOYEE"]),
    status: Random.pick([1, 0]),
  });

  return {
    success: true,
    message: "",
    code: "200",
    data,
  };
}

function updateEmployee(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {},
  };
}

function deleteEmployee(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {},
  };
}

export default {
  pageSearchEmployee,
  searchSingleEmployee,
  updateEmployee,
  deleteEmployee,
};
